﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bouyei.Geo.GeoParsers.GeoJson
{
    public class PointMArray :IArray<PointArray>
    {
        private int position = 0;

        private LineArray Array;

        public PointMArray()
        {

        }

        public PointMArray(int capacity)
        {
            Array = new LineArray(capacity);
        }

        public void FromWkt(string wkt)
        {
            Array.FromWkt(wkt);
        }

        public object Current => Array[position];

        public PointArray this[int index]
        {
            get { return Array[index]; }
            set { Array[index] = value; }
        }

        public bool MoveNext()
        {
            ++position;
            return position < Array.Count();
        }

        public void Reset()
        {
            position = 0;
        }

        public IEnumerator<PointArray> GetEnumerator()
        {
            foreach (var item in Array)
                yield return item;
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            foreach (var item in Array)
                yield return item;
        }
    }
}
